package app.ui;

import java.awt.Color;

import javax.swing.JButton;
import javax.swing.JTextField;

import app.action.StartAction;

public class StartUi extends AbsCommonPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = -6829161897586243050L;

	private JTextField jTextField1 = new JTextField();
	private JButton jButton1 = new JButton("Browse...");
	private JButton jButton2 = new JButton("Create Data File");
	private JButton jButton3 = new JButton("Start");

	public StartUi(MainFrame mFrame) {
		super(mFrame);

		doAddComponents();
	}

	@Override
	protected void doAddComponents() {
		add(jTextField1);
		add(jButton1);
		add(jButton2);
		add(jButton3);

		initializeComponents();
	}

	@Override
	public void initializeComponents() {
		setBackground(Color.BLACK);

		StartAction startAction = new StartAction(this);
		jButton1.addActionListener(startAction);
		jButton2.addActionListener(startAction);
		jButton3.addActionListener(startAction);

		jButton3.setEnabled(false);
	}

	@Override
	public void resizeComponents() {
		final int btnWid = 160;
		final int btnHei = 35;
		int height = this.getHeight() - 40;
		int x = 10;
		int y = (height - btnHei) / 2;
		int width = this.getWidth() - btnWid - 25;

		jTextField1.setBounds(x, y, width, btnHei);
		x = this.getWidth() - 10 - btnWid;
		jButton1.setBounds(x, y, btnWid, btnHei);
		x = this.getWidth() - 10 - btnWid;
		y = height - 5;
		jButton2.setBounds(x, y, btnWid, btnHei);
		y = y - 10 - btnHei;
		jButton3.setBounds(x, y, btnWid, btnHei);
	}

	public JTextField getjTextField1() {
		return jTextField1;
	}

	public JButton getjButton1() {
		return jButton1;
	}

	public JButton getjButton2() {
		return jButton2;
	}

	public JButton getjButton3() {
		return jButton3;
	}
}
